Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/remove redialing #842

Merged
merged 45 commits into from
Aug 23, 2021

Conversation

i-hate-nicknames
Copy link
Contributor

@i-hate-nicknames i-hate-nicknames commented Jul 9, 2021

Did you run make format && make check?

Fixes #830
Fixes #844
Fixes #843

Changes:

  • Remove transport redialing
  • Remove transport statuses as a concept
  • Add persistent transports configuration (transports that are repeatedly redialed when broken, and are set up at visor startup)

How to test this PR:

  • Run a couple of visors and establish transports between them manually, delete those transports manually, crash visors deliberately.
  • Use transport setup to add skywire transports and public visors and check that the connections are properly get set up and are not reconnected.
  • Add persistent transports to configuration and check that it gets established on startup and reestablished when the target visor goes offline and back

A known issue is that sudph transports do not get closed automatically, when other end of connection closes. This could be an issue with kcp-go library configuration, or it could be the case that the library doesn't support it.
For this case, I added an automatic connection close logic, built on net.Conn deadline logic. Basically, the idea is to update deadline every time the connection is used.
For this to work properly, we need to add support for some kind of keep-alive messages to the transport layer.
Currently, it is disabled (deadline is 0 and ignored by conn).

Shutdown logic is also fixed in this PR, since I thought it would help with sudph issues.

Copy link
Member

@jdknives jdknives left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Well done.

@@ -66,16 +56,8 @@ type ManagedTransport struct {
LogEntry *LogEntry
logUpdates uint32

dc DiscoveryClient
ls LogStore
ebc *appevent.Broadcaster
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need this structure though? Adding new transports at runtime is required to trigger events to be broadcasted to VPN for example. Am I missing somehting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked and they were not used anywhere else except for some tcp events. I moved those events to transport manager itself to avoid passing those around, but perhaps they should be kept here.

@jdknives
Copy link
Member

jdknives commented Jul 9, 2021

Please also remove the Char file. Not related to this PR but it should not be in the repo.

@i-hate-nicknames i-hate-nicknames marked this pull request as ready for review July 30, 2021 09:53
Previously on transport save the whole manager would be blocked
until the whole process is finished

Now, saveTransport method only locks in critical sections, and sometimes
uses lighter locks (RLock). This allows multiple saveTransport methods
to run simultaneously
Copy link
Member

@jdknives jdknives left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should rename the Conn Interface to transport interface as that seems to be what it is judging from our current naming conventions (i.e. the structure encapsulating it being called managed transport`) and from spec.

pkg/transport/managed_transport.go Outdated Show resolved Hide resolved
pkg/transport/handshake.go Outdated Show resolved Hide resolved
pkg/transport/managed_transport.go Outdated Show resolved Hide resolved
pkg/transport/managed_transport.go Outdated Show resolved Hide resolved
@jdknives
Copy link
Member

jdknives commented Aug 7, 2021

@ersonp as @i-hate-nicknames is out, I would like you to take over the rest of the comments as they are not too broad in scope or deep in effect. After changes are made, make sure to give a good bit of testing to the overall PR and we should get this merged.

Copy link
Contributor

@mrpalide mrpalide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good, and testing between this PR and master work without problem.

Copy link
Member

@jdknives jdknives left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check for and remove all occurences of transport connection and rename it to plain transport. Having both is redundant and therefore confusing. Also a few small comments otherwise.

pkg/transport/handshake.go Outdated Show resolved Hide resolved
pkg/transport/managed_transport.go Outdated Show resolved Hide resolved
pkg/transport/managed_transport.go Outdated Show resolved Hide resolved
pkg/transport/managed_transport.go Outdated Show resolved Hide resolved
pkg/transport/managed_transport.go Outdated Show resolved Hide resolved
pkg/transport/managed_transport.go Outdated Show resolved Hide resolved
Copy link
Member

@jdknives jdknives left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API looks good! Now that I see it, I am not sure if Senyoret actually needs the GetPersistentTransports or whether it would be more convenient to get it in the Summary call. @Senyoret1 let us know.

@ersonp ersonp mentioned this pull request Aug 20, 2021
@Senyoret1
Copy link
Contributor

If persistent and non-persistent transports are going to be shown just as the transports are being shown at this moment in the UI, having all the data in the summary would be the best option, as no changes in the UI would be needed. If you want the UI to do something special with persistent transports, then I would need more info to know what would have to be done and what will be nedded

@ersonp
Copy link
Contributor

ersonp commented Aug 23, 2021

We will need to show the list of persistent transports set up by the user as well as a way for the user to add or remove them. Is there anything more that needs to be done @jdknives

@jdknives jdknives merged commit 9f4e684 into skycoin:develop Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants